package com.maotai.app.bean;

import java.io.UnsupportedEncodingException;
import java.util.Random;

public class CustomAppName {
	public static String[] name = { "罗治和", "邓飞", "周伟", "杨名林", "刘江强", "虞安德",
			"曾少群", "黄代洁", "黄思容", "舒岳阳", "吴开文", "韦仕晚", "项小明", "林超淡", "张帆",
			"王小兵", "蒋泽洋", "陈兵", "邹德峰", "姚建国", "郭辉", "李占宁", "郭汉民", "汪银和", "李振奎",
			"张磊", "王豫赣", "刘克峰", "刘兵", "韩存晓", "王力", "汪文亚", "李锐", "王兴飞", "李东明",
			"孙振洲", "冯建洲", "南现卿", "贾增科", "刘建立", "蒋国选", "魏五洋", "刘太远", "于战士",
			"宋利勇", "张忠利", "杜黔川", "丰建海", "李卫超", "金益君", "石强", "袁旺霞", "吴照勇",
			"陈颂农", "李建强", "闵放之", "董德光", "白玉丰", "张镇斌", "高贺贺", "田少雄", "吕继峰",
			"李家伟", "王甲栋", "罗延峰", "匡振平", "宋兴龙", "许海峰", "伍交忆", "许名亮", "高立朝",
			"晁云磊", "迭瑞喜", "胡俊", "方庆磊", "张国强", "胡浩", "李新", "吕春来", "徐安民", "尹军勇",
			"苗雷雷", "唐强", "刘威龙", "陈海昌", "余厚旺", "林德文", "邹斌", "沈杰", "王佩川", "张先政",
			"彭飞", "高文明", "梁光海", "胡春磊", "曾超", "司岳钱", "叶广声", "阮金斗", "梁志勇" };
	public static String address[] = { "荷叶新村", "孙蒋新村", "仙蠡墩家园", "中建溪岸官邸" };
	public static String shangdian[] = { "粮店", "食品点", "煤店", "食品杂货", "酱园", "",
			"肉店", "酒店", "水产店", "家禽店", "豆腐店", "烤肉店", "卤味店", "饮食店", "小吃店", "饭店",
			"冷饮店", "蔬菜店水果店", "蔬菜店", "鞋帽店", "百货公司", "百货商场", "服装店", "成衣店",
			"呢绒绸布店", "药店", "儿童用品商店", "妇女用品商店", "钟表店", "文具店", "日用杂货店", "炊事用具商店",
			"家用器具商店", "五金商店", "家具店", "眼镜店", "玻璃礼品店", "爆竹鞭炮店", "电器商店", "油漆店",
			"化工油漆染料店", "地产建材商店", "照相馆", "旧货店", "综合修理店", "花店", "古玩珠宝店", "香烟店",
			"售报亭", "茶馆", "理发店", "洗澡堂", "旅店", "邮局" };
	public static String zimu[] = { "a", "b", "c", "d", "", "e", "f", "g", "h",
			"i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u",
			"v", "w", "x", "y", "z" };

	public static String getZimu() {
		int max = zimu.length;
		int min = 0;
		Random random = new Random();
		int s = random.nextInt(max) % (max - min + 1) + min;
		return zimu[s];
	}

	public static String getNewTel() {
		int max = 9;
		int min = 0;
		Random random = new Random();
		int s1 = random.nextInt(max) % (max - min + 1) + min;
		int s2 = random.nextInt(max) % (max - min + 1) + min;
		int s3 = random.nextInt(max) % (max - min + 1) + min;
		int s4 = random.nextInt(max) % (max - min + 1) + min;
		int s5 = random.nextInt(max) % (max - min + 1) + min;
		return "180000" + s1 + s2 + s3 + s4 + s5;
	}

	public static String getName() {
		int max = 99;
		int min = 0;
		Random random = new Random();
		int s = random.nextInt(max) % (max - min + 1) + min;
		return name[s];
	}

	public static String getAddress() {
		int max = 3;
		int min = 0;
		Random random = new Random();
		int s = random.nextInt(max) % (max - min + 1) + min;
		return address[s];
	}

	public static String getAddressCode() {
		int max = 9;
		int min = 0;
		Random random = new Random();
		int s1 = random.nextInt(max) % (max - min + 1) + min;
		int s2 = random.nextInt(max) % (max - min + 1) + min;
		int s3 = random.nextInt(max) % (max - min + 1) + min;
		return "1" + s1 + s2 + s3;
	}

	public static String getMenPaiCode() {
		int max = 9;
		int min = 0;
		Random random = new Random();
		int s1 = random.nextInt(max) % (max - min + 1) + min;
		int s2 = random.nextInt(max) % (max - min + 1) + min;
		return "1" + s1 + s2;
	}

	public static String getMenPai() {
		int max = shangdian.length;
		int min = 0;
		Random random = new Random();
		int s = random.nextInt(max) % (max - min + 1) + min;
		return shangdian[s];
	}

	public static String getRandomChar() throws UnsupportedEncodingException {
		Random random = new Random();
		String[] rBase = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9",
				"a", "b", "c", "d", "e", "f" };
		// 生成第1位的区码
		int r1 = random.nextInt(3) + 11; // 生成11到14之间的随机数
		String str_r1 = rBase[r1];
		// 生成第2位的区码
		int r2;
		if (r1 == 13) {
			r2 = random.nextInt(7); // 生成0到7之间的随机数
		} else {
			r2 = random.nextInt(16); // 生成0到16之间的随机数
		}
		String str_r2 = rBase[r2];
		// 生成第1位的位码
		int r3 = random.nextInt(6) + 10; // 生成10到16之间的随机数
		String str_r3 = rBase[r3];
		// 生成第2位的位码
		int r4;
		if (r3 == 10) {
			r4 = random.nextInt(15) + 1; // 生成1到16之间的随机数
		} else if (r3 == 15) {
			r4 = random.nextInt(15); // 生成0到15之间的随机数
		} else {
			r4 = random.nextInt(16); // 生成0到16之间的随机数
		}
		String str_r4 = rBase[r4];
//		System.out.println("区码+位码=" + str_r1 + str_r2 + str_r3 + str_r4);

		// 将生成机内码转换为汉字
		byte[] bytes = new byte[2];
		// 将生成的区码保存到字节数组的第1个元素中
		String str_r12 = str_r1 + str_r2;
		int tempLow = Integer.parseInt(str_r12, 16);
		bytes[0] = (byte) tempLow;
		// 将生成的位码保存到字节数组的第2个元素中
		String str_r34 = str_r3 + str_r4;
		int tempHigh = Integer.parseInt(str_r34, 16);
		bytes[1] = (byte) tempHigh;
		String ctmp = new String(bytes, "gb2312"); // 根据字节数组生成汉字
//		System.out.println("生成汉字:" + ctmp);
		return ctmp;
	}
	public static String getRoad(){
		int max = 4;
		int min = 2;
		Random random = new Random();
		int s1 = random.nextInt(max) % (max - min + 1) + min;
		String temp = "";
		try{
			for(int i=0;i<s1;i++){
				temp +=getRandomChar();
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		return temp;
	}
	public static String getNameNew(){
		int max = 5;
		int min = 3;
		Random random = new Random();
		int s1 = random.nextInt(max) % (max - min + 1) + min;
		String temp = "";
		try{
			for(int i=0;i<s1;i++){
				temp +=getZimu();
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		return temp;
	}
	public static String getNum(){
		int max = 4;
		int min = 1;
		Random random = new Random();
		int s1 = random.nextInt(max) % (max - min + 1) + min;
		String temp = "";
		try{
			for(int i=0;i<s1;i++){
				int s2 = random.nextInt(9) % (9 - 1 + 1) + 1;;
				temp +=s2+"";
			}
		}catch(Exception e){
			e.printStackTrace();
		}
		return temp;
	}
	public static void main(String[] args) {
		try {
			System.out.println(getRandomChar());
		} catch (UnsupportedEncodingException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
